package com.tubang.logistics.controller.orderV2;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.tubang.common.constant.Constants;
import com.tubang.common.util.*;
import com.tubang.component.entity.AddressEntity;
import com.tubang.component.service.IAddressService;
import com.tubang.component.util.RequestUtil;
import com.tubang.logistics.entity.*;
import com.tubang.logistics.service.*;
import com.tubang.logistics.vo.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 运单控制器
 * </p>
 *
 * @author wsl
 * @since 2017-12-31
 */
@RestController
@RequestMapping("/trucker")
public class OrderTruckerController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Resource
    private IGoodsService goodsService;


    @Resource
    private IAddressService addressService;


    @Resource
    private ITransportService transportService;


    @Resource
    private ITruckerOrderService truckerOrderService;


    @Resource
    private ITruckerOrderGoodsService truckerOrderGoodsService;


    @Resource
    private ILogisticsOrderService logisticsOrderServices;

    @Resource
    private ILogisticsOrderGoodsService logisticsOrderGoodsService;

    @Resource
    private ILogisticsBillService logisticsBillService;


    /**
     * 货源中心-列表 抢单 竞价 指派
     *
     * @param
     * @return
     */
    @GetMapping(value = "truckerSuppList")
    public ResultData truckerSuppList(@RequestParam(required = false) String addrFrom,
                                      @RequestParam(required = false) String addrTo,
                                      @RequestParam(required = false) String num,
                                      @RequestParam(required = false) String statusCode,//逗号隔开的  需要处理
                                      @RequestParam(required = false) String companyId, // 司机 id
                                      @RequestParam(required = false) String userId, // 平台 id  公司 id
                                      @RequestParam(required = false) String containerType,//车辆类型
                                      @RequestParam(required = false) String containerSize,//车辆长度
                                      @RequestParam(required = false, defaultValue = "1") Integer page,
                                      @RequestParam(required = false, defaultValue = "10") Integer rows) {
        try {

            EntityWrapper<LogisticsOrderEntity> logisticswrapper = new EntityWrapper<>();

            if (StringUtils.isNotEmpty(num)) {
                logisticswrapper.eq("num", num);
            }
            if (StringUtils.isNotEmpty(statusCode)) {
                if (Constants.ORDER_STATUS_DESIGNATE.equals(statusCode)) {
                    logisticswrapper.eq("carrier_id", companyId).eq("status_code", statusCode);
                } else {
                    logisticswrapper.eq("status_code", statusCode);
                }
            }

            if (StringUtils.isNotEmpty(userId)) {
                logisticswrapper.in("user_id", userId);
            }

            if (StringUtils.isNotEmpty(addrFrom)) {
                logisticswrapper.like("addr_from", addrFrom);
            }


            if (StringUtils.isNotEmpty(addrTo)) {
                logisticswrapper.like("addr_to", addrTo);
            }

            if (StringUtils.isNotEmpty(containerType)) {
                logisticswrapper.eq("container_type", containerType);
            }

            if (StringUtils.isNotEmpty(containerSize)) {
                logisticswrapper.eq("container_size", containerSize);
            }

            logisticswrapper.eq("enable", Constants.DEFAULT_VAULE_ONE);

            int logisticsCount = logisticsOrderServices.selectCount(logisticswrapper);
            Page<LogisticsOrderEntity> logisticsOrderPage = logisticsOrderServices.selectPage(new Page(page, rows), logisticswrapper);
            List<OrderListVo> logisticsOrderListVos = BeanMapper.mapList(logisticsOrderPage.getRecords(), OrderListVo.class);
            for (OrderListVo lo : logisticsOrderListVos) {
                try {

                    GoodsEntity goodsEntity = goodsService.selectBaseGoodsByLogisticsOrderId(lo.getId());
                    TransportEntity transportEntity = transportService.selectById(goodsEntity.getTransportId());
                    lo.setGoodsName(goodsEntity.getName());
                    lo.setWeight(String.valueOf(goodsEntity.getWeight()));
                    AddressEntity fAddressEntity = addressService.selectById(transportEntity.getFromUserAddressId());
                    AddressEntity tAddressEntity = addressService.selectById(transportEntity.getToUserAddressId());
                    lo.setAddressFrom(fAddressEntity);
                    lo.setAddresTo(tAddressEntity);
                    lo.setOrderType(Constants.USER_TYPE_OUTSIDE_COMPANY);
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.error("数据加工失败，物流公司运单编号为：{}==,,失败原因为{}", lo.getId(), e.getMessage());
                    return ResultData.result(false).setData(e);
                }
            }

            return ResultData.result(true).setData(logisticsOrderListVos).setTotalCount(logisticsCount);
        } catch (Exception e)

        {
            logger.error("[OrderTruckerController]<== method[truckerList], 更新状态失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }

    /**
     * 订单 运单列表
     *
     * @param
     * @return
     */
    @GetMapping(value = "truckerList")
    public ResultData truckerList(@RequestParam(required = false) String addrFrom,
                                  @RequestParam(required = false) String addrTo,
                                  @RequestParam(required = false) String num,
                                  @RequestParam(required = false) String statusCode,//逗号隔开的  需要处理
                                  @RequestParam(required = false) String companyId, // 司机 id
                                  @RequestParam(required = false) String userId, // 平台 id  公司 id
                                  @RequestParam(required = false, defaultValue = "1") Integer page,
                                  @RequestParam(required = false, defaultValue = "10") Integer rows) {
        try {

            //
            EntityWrapper<TruckerOrderEntity> entityWrapper = new EntityWrapper<TruckerOrderEntity>();
            if (StringUtils.isNotEmpty(num)) {
                entityWrapper.eq("num", num);
            }
            if (StringUtils.isNotEmpty(statusCode)) {
                String[] split = statusCode.split(",");
                entityWrapper.in("status_code", split);
            }

            if (StringUtils.isNotEmpty(companyId)) {
                entityWrapper.eq("carrier_id", companyId);
            }

            if (StringUtils.isNotEmpty(addrFrom)) {
                entityWrapper.like("addr_from", addrFrom);
            }


            if (StringUtils.isNotEmpty(addrTo)) {
                entityWrapper.like("addr_to", addrTo);
            }


            if (StringUtils.isNotEmpty(userId)) {
                entityWrapper.like("user_id", userId);
            }

            entityWrapper.eq("enable", Constants.DEFAULT_VAULE_ONE);


            Page<TruckerOrderEntity> truckerOrderEntityPage = truckerOrderService.selectPage(new Page<TruckerOrderEntity>(page, rows), entityWrapper);
            List<TruckerOrderEntity> records = truckerOrderEntityPage.getRecords();
            List<OrderListVo> orderListVos = new ArrayList<OrderListVo>();
            for (TruckerOrderEntity truckerOrderEntity : records) {
                String orderId = truckerOrderEntity.getId();
                OrderListVo orderListVo = new OrderListVo();
                BeanMapper.copy(truckerOrderEntity, orderListVo);
                //orderListVo.setGoodsWeight(truckerOrderEntity.getGoodsWeight());
                //orderListVo.setCarriage(truckerOrderEntity.getCarriage());
                GoodsEntity goodsBasic = new GoodsEntity();
                List<TruckerOrderGoodsEntity> truckerOrderGoodsEntitys = truckerOrderGoodsService.selectOrderByOrderId(orderId);
                for (TruckerOrderGoodsEntity truckerOrderGoodsEntity : truckerOrderGoodsEntitys) {
                    goodsBasic = goodsService.selectBaseGoodsByGoodsId(truckerOrderGoodsEntity.getGoodsId());

                }
                TransportEntity transportEntity = transportService.selectByOrderId(goodsBasic.getShipperOrderId());
                //地址
                if (transportEntity != null) {
                    AddressEntity from = addressService.selectById(transportEntity.getFromUserAddressId());
                    AddressEntity to = addressService.selectById(transportEntity.getToUserAddressId());
                    orderListVo.setAddressFrom(from);
                    orderListVo.setAddresTo(to);
                    BeanMapper.copy(transportEntity, orderListVo);
                }
                orderListVo.setId(orderId);
                orderListVo.setWeight(String.valueOf(truckerOrderEntity.getGoodsWeight()));
                orderListVos.add(orderListVo);
            }

            int count = truckerOrderService.selectCount(entityWrapper);

            return ResultData.result(true).setData(orderListVos).setTotalCount(count);
        } catch (Exception e) {
            logger.error("[OrderTruckerController]<== method[truckerList], 更新状态失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }


    /**
     * 运单详情
     *
     * @param
     * @return
     */
    @GetMapping(value = "truckerOrderInfo")
    public ResultData truckerOrderInfo(@RequestParam(required = false) String orderId,
                                       @RequestParam(required = false) String orderType) {
        try {
            OrderbillInfoVo orderbillInfoVo = new OrderbillInfoVo();
            List<GoodsEntity> goodsEntities = new ArrayList<GoodsEntity>();
            GoodsEntity baseGoods = null;
            GoodsBaseVo goodsBaseVo = new GoodsBaseVo();
            DecimalFormat decimalFormat = new DecimalFormat("######0.000");
            if (Constants.USER_TYPE_OUTSIDE_COMPANY.equals(orderType)) {
                //物流公司
                LogisticsOrderEntity logisticsOrderEntity = logisticsOrderServices.selectById(orderId);
                BeanMapper.copy(logisticsOrderEntity, orderbillInfoVo);
                goodsEntities = goodsService.selectGoodssByLogisticsOrderId(orderId, null);
                baseGoods = goodsService.selectBaseGoodsByLogisticsOrderId(orderId);
                if (baseGoods != null) {
                    BeanMapper.copy(baseGoods, goodsBaseVo);
                    goodsBaseVo.setName(logisticsOrderEntity.getGoodsName());
                    goodsBaseVo.setWeight(new BigDecimal(decimalFormat.format(logisticsOrderEntity.getGoodsWeight())));
                    goodsBaseVo.setLeftWeight(new BigDecimal(decimalFormat.format(logisticsOrderEntity.getGoodsWeight())));
                    orderbillInfoVo.setGoodsBaseVo(goodsBaseVo);

                }

            } else {
                TruckerOrderEntity truckerOrderEntity = truckerOrderService.selectById(orderId);
                BeanMapper.copy(truckerOrderEntity, orderbillInfoVo);
                goodsEntities = goodsService.selectGoodssByTruckerOrderId(orderId);
                baseGoods = goodsService.selectBaseGoodsByTruckerOrderId(orderId);
                if (baseGoods != null) {
                    BeanMapper.copy(baseGoods, goodsBaseVo);
                    goodsBaseVo.setName(truckerOrderEntity.getGoodsName());
                    goodsBaseVo.setWeight(new BigDecimal(decimalFormat.format(truckerOrderEntity.getGoodsWeight())));
                    goodsBaseVo.setLeftWeight(new BigDecimal(decimalFormat.format(truckerOrderEntity.getGoodsWeight())));
                    orderbillInfoVo.setGoodsBaseVo(goodsBaseVo);

                }
            }

            List<GoodsInfoVo> goodsInfoVos = BeanMapper.mapList(goodsEntities, GoodsInfoVo.class);

            //货品列表

            if (baseGoods != null) {
                TransportEntity transportEtity = transportService.selectById(baseGoods.getTransportId());
                if (transportEtity != null) {
                    AddressEntity fAddressEntity = addressService.selectById(transportEtity.getFromUserAddressId());
                    AddressEntity tAddressEntity = addressService.selectById(transportEtity.getToUserAddressId());
                    orderbillInfoVo.setAddressFrom(fAddressEntity);
                    orderbillInfoVo.setAddresTo(tAddressEntity);
                    BeanMapper.copy(transportEtity, orderbillInfoVo);
                    orderbillInfoVo.setUnloadPlanDateStr(DateFormatUtils.formatDate(transportEtity.getUnloadPlanDate(), "yyyy-MM-dd HH:mm:ss"));
                    // orderbillInfoVo.setUnloadRealDateStr(DateFormatUtils.formatDate(transportEtity.getUnloadRealDate(),"yyyy-MM-dd HH:mm:ss"));
                    orderbillInfoVo.setTakePlanDateStr(DateFormatUtils.formatDate(transportEtity.getTakePlanDate(), "yyyy-MM-dd HH:mm:ss"));
                    //orderbillInfoVo.setTakeRealDateStr(DateFormatUtils.formatDate(transportEtity.getTakeRealDate(),"yyyy-MM-dd HH:mm:ss"));
                }

            }
            orderbillInfoVo.setGoodsInfoVoS(goodsInfoVos);

            return ResultData.result(true).setData(orderbillInfoVo);
        } catch (Exception e) {
            logger.error("[OrderTruckerController]<== method[truckerOrderInfo], 查询详情 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }


    /**
     * 更新订单 运单状态
     *
     * @param
     * @return
     */
    @PostMapping(value = "updateTruckerOrderStatus")
    public ResultData updateTruckerOrderStatus(HttpServletRequest request) {
        try {
            String receivePostJson = RequestUtil.receivePostJson(request);
            ChangeStatusVo changeStatusVo = GsonQuick.toObject(receivePostJson, ChangeStatusVo.class);
            //更新状态
            truckerOrderService.updateTruckerOrderStatus(changeStatusVo);
            return ResultData.result(true);
        } catch (Exception e) {
            logger.error("[OrderTruckerController]<== method[updateTruckerOrderStatus], 更新状态失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }


    /**
     * @param request
     * @param response
     * @return ResultData 返回类型
     * @throws
     * @Title logisticsBargain
     * @Description 上传提货单，并确认提货
     */
    @PostMapping(value = "truckerOrderTakeGoods")
    public ResultData truckerOrderTakeGoods(HttpServletRequest request, HttpServletResponse response) {
        String receivePostJson = RequestUtil.receivePostJson(request);
        TruckerBackVo truckerBackVo = GsonQuick.toObject(receivePostJson, TruckerBackVo.class);
        try {
            if (StringUtils.isBlank(truckerBackVo.getId())) {
                return ResultData.result(false).setCode(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST).setMsg(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST_DESC);
            }
            if (StringUtils.isBlank(truckerBackVo.getDeliveryOrderUrl())) {
                return ResultData.result(false).setCode(MsgCode.DELIVERY_ORDER_URL_NOT_EXIST).setMsg(MsgCode.DELIVERY_ORDER_URL_NOT_EXIST_DESC);
            }
            TruckerOrderEntity truckerOrderEntity = truckerOrderService.selectById(truckerBackVo.getId());
            //判断是不是已接单的状态
            if (!StringUtils.equals(Constants.ORDER_WAITING_PICK_UP_GOODS, truckerOrderEntity.getStatusCode())) {
                return ResultData.result(false).setCode(MsgCode.ORDER_DATA_ERROR).setMsg(MsgCode.ORDER_DATA_ERROR_DESC);
            }
            truckerOrderEntity.setStatusCode(truckerBackVo.getStatusCode());
            truckerOrderEntity.setStatusCodeDesc(truckerBackVo.getStatusCodeDesc());
            truckerOrderEntity.setDeliveryOrderUrl(truckerBackVo.getDeliveryOrderUrl());
            truckerOrderService.insertOrUpdate(truckerOrderEntity);
            //更新与此订单中所以货品相关的状态
            List<TruckerOrderGoodsEntity> truckerOrderGoodsEntities = truckerOrderGoodsService.selectOrderByOrderId(truckerBackVo.getId());
            //生成货品id集合
            List<String> goodsIdlist = new ArrayList<String>();
            for (TruckerOrderGoodsEntity truckerOrderGoodsEntity : truckerOrderGoodsEntities) {
                goodsIdlist.add(truckerOrderGoodsEntity.getGoodsId());
            }
            //更新相关订单状态
            logisticsOrderServices.updateLogisticsOrderStatusTspByGoodsIds(goodsIdlist, Constants.ORDER_IN_TRANSIT, "运输中");

            return ResultData.result(true);
        } catch (Exception e) {
            logger.error("[OrderLogisticsController]<== method[logisticsTakeGoods],上传提货单，并确认提货 失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }

    /**
     * @param request
     * @param response
     * @return ResultData 返回类型
     * @throws
     * @Title logisticsBargain
     * @Description 上传回执单，等待审核
     */
    @PostMapping(value = "truckerOrderTakeReceipt")
    public ResultData truckerOrderTakeReceipt(HttpServletRequest request, HttpServletResponse response) {
        String receivePostJson = RequestUtil.receivePostJson(request);
        TruckerBackVo truckerBackVo = GsonQuick.toObject(receivePostJson, TruckerBackVo.class);
        try {
            if (StringUtils.isBlank(truckerBackVo.getId())) {
                return ResultData.result(false).setCode(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST).setMsg(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST_DESC);
            }
            if (StringUtils.isBlank(truckerBackVo.getReceiptUrl())) {
                return ResultData.result(false).setCode(MsgCode.RECEIPT_URL_NOT_EXIST).setMsg(MsgCode.RECEIPT_URL_NOT_EXIST_DESC);
            }
            TruckerOrderEntity truckerOrderEntity = truckerOrderService.selectById(truckerBackVo.getId());
            //判断是不是运输中
            if (!StringUtils.equals(Constants.ORDER_IN_TRANSIT, truckerOrderEntity.getStatusCode())) {
                return ResultData.result(false).setCode(MsgCode.ORDER_DATA_ERROR).setMsg(MsgCode.ORDER_DATA_ERROR_DESC);
            }
            truckerOrderEntity.setStatusCode(truckerBackVo.getStatusCode());
            truckerOrderEntity.setStatusCodeDesc(truckerBackVo.getStatusCodeDesc());
            truckerOrderEntity.setReceiptUrl(truckerBackVo.getReceiptUrl());
            truckerOrderService.insertOrUpdate(truckerOrderEntity);
            return ResultData.result(true);
        } catch (Exception e) {
            logger.error("[OrderLogisticsController]<== method[logisticsTakeGoods],上传提货单，并确认提货 失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }

    /**
     * @param request
     * @param response 104 105
     * @return ResultData 返回类型
     * @throws
     * @Title logisticsBargain
     * @Description 审核运单
     */
    @PostMapping(value = "truckerOrderAudit")
    public ResultData truckerOrderAudit(HttpServletRequest request, HttpServletResponse response) {
        String receivePostJson = RequestUtil.receivePostJson(request);
        TruckerBackVo truckerBackVo = GsonQuick.toObject(receivePostJson, TruckerBackVo.class);
        try {

            if (StringUtils.isBlank(truckerBackVo.getId())) {
                return ResultData.result(false).setCode(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST).setMsg(MsgCode.ADDRESS_FAIL_IS_NOT_EXIST_DESC);
            }
            TruckerOrderEntity truckerOrderEntity = truckerOrderService.selectById(truckerBackVo.getId());
            //判断是否审核通过
            if (!StringUtils.equals(Constants.ORDER_WAIT_FOR_CONFIRMATION, truckerOrderEntity.getStatusCode())) {
                return ResultData.result(false).setCode(MsgCode.ORDER_DATA_ERROR).setMsg(MsgCode.ORDER_DATA_ERROR_DESC);
            }
            truckerOrderEntity.setStatusCode(truckerBackVo.getStatusCode());
            truckerOrderEntity.setStatusCodeDesc(truckerBackVo.getStatusCodeDesc());
            truckerOrderService.insertOrUpdate(truckerOrderEntity);
            //更新与此订单中所以货品相关的状态
            List<TruckerOrderGoodsEntity> truckerOrderGoodsEntities = truckerOrderGoodsService.selectOrderByOrderId(truckerBackVo.getId());
            //生成货品id集合
            List<String> goodsIdlist = new ArrayList<String>();
            for (TruckerOrderGoodsEntity truckerOrderGoodsEntity : truckerOrderGoodsEntities) {
                goodsIdlist.add(truckerOrderGoodsEntity.getGoodsId());
            }
            //更新相关订单状态
            //logisticsOrderServices.updateLogisticsOrderStatusAdmByGoodsIds(goodsIdlist, Constants.ORDER_IN_TRANSIT, "运输中");

            if (truckerBackVo.getStatusCode() != null && truckerBackVo.getStatusCode().equals(Constants.ORDER_HAVA_COMPLETED)) {
                //审核通过生成账单
                LogisticsBill logisticsBill = new LogisticsBill();
                BeanMapper.copy(truckerOrderEntity, logisticsBill);
                logisticsBill.setId(null);
                logisticsBill.setNum(IdGenerator.INSTANCE.nextId());
                logisticsBill.setOrderNum(truckerOrderEntity.getNum());
                logisticsBill.setOrderId(truckerOrderEntity.getId());
                logisticsBill.setFinishTime(truckerOrderEntity.getUpdateTime());
                logisticsBill.setStatusCode(null);
                logisticsBillService.insertOrUpdate(logisticsBill);
            }


            return ResultData.result(true);
        } catch (Exception e) {
            logger.error("[OrderLogisticsController]<== method[logisticsTakeGoods],上传提货单，并确认提货 失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }

    /**
     * @param request
     * @param response
     * @return ResultData 返回类型
     * @throws
     * @Title logisticsBargain
     * @Description 接单 驳回
     */
    @PostMapping(value = "truckerOrderReject")
    public ResultData truckerOrderReject(HttpServletRequest request, HttpServletResponse response) {

        try {
            String receivePostJson = RequestUtil.receivePostJson(request);
            OrderBiddingVo orderBiddingVo = GsonQuick.toObject(receivePostJson, OrderBiddingVo.class);

            Date now = new Date();
            //公司指派来的单 (接单,驳回)
            String orderType = orderBiddingVo.getOrderType();
            Integer status = orderBiddingVo.getStatus();
            if (Constants.USER_TYPE_OUTSIDE_COMPANY.equals(orderType)) {
                LogisticsOrderEntity logisticsOrderEntity = logisticsOrderServices.selectById(orderBiddingVo.getOrderId());
                if (logisticsOrderEntity == null) ResultData.result(true);

                logisticsOrderEntity.setStatusCode(String.valueOf(status));
                logisticsOrderEntity.setStatusCodeDesc(orderBiddingVo.getStatusCodeDesc());
                logisticsOrderEntity.setCarrierId(orderBiddingVo.getCarrierId());
                logisticsOrderEntity.setCarrierName(orderBiddingVo.getCarrierName());
                logisticsOrderEntity.setCarrierMobile(orderBiddingVo.getCarrierMobile());
                logisticsOrderEntity.setRemarks(orderBiddingVo.getRemarks());
                Double carriage = logisticsOrderEntity.getCarriage();
                if (carriage != null && carriage > 0) {
                    logisticsOrderEntity.setCarriage(carriage);
                }
                logisticsOrderEntity.setUpdateTime(now);
                logisticsOrderServices.insertOrUpdate(logisticsOrderEntity);
                //补充数据用户id
                orderBiddingVo.setUserId(logisticsOrderEntity.getUserId());
                orderBiddingVo.setUserType(Constants.USER_TYPE_OUTSIDE_COMPANY);
                orderBiddingVo.setCarriage(logisticsOrderEntity.getCarriage());
                orderBiddingVo.setAmount(logisticsOrderEntity.getAmount());
                //如果是接单 需要创建订单  待提货
                if (!Constants.ORDER_STATUS_REFUSE_ORDER.equals(String.valueOf(status))) {
                    orderBiddingVo.setStatus(Constants.ORDER_STATUS_CODE_TAKE_GOODS);
                    orderBiddingVo.setStatusCodeDesc("待提货");
                    orderBiddingVo.setGoodsName(logisticsOrderEntity.getGoodsName());
                    orderBiddingVo.setGoodsWeight(logisticsOrderEntity.getGoodsWeight());
                    orderBiddingVo.setCarriage(logisticsOrderEntity.getCarriage());
                    orderBiddingVo.setAmount(logisticsOrderEntity.getAmount());
                    truckerOrderService.creatTruckerOrderBeforLogisticsOrder(orderBiddingVo);
                } else {
                    //数据回滚
                    logisticsOrderServices.orderRobackStatuscode(logisticsOrderEntity);
                }

            }
            return ResultData.result(true);
        } catch (Exception e) {
            logger.error("[OrderLogisticsController]<== method[logisticsTakeGoods],上传提货单，并确认提货 失败 :[{}]", e.getMessage());
            e.printStackTrace();
            return ResultData.result(false).setData(e);
        }
    }


}
